$def with(work, tags=[])

$def render_subjects(label, subjects, track_value, prefix=""):
  $if subjects:
    <div class="section link-box">
      <span class="clamp" data-before="&#9656; ">
      <h3>$label</h3>
        $for subject in subjects:
          <a href="/subjects/$prefix$utf8(subject.lower().replace(' ', '_').replace(',', '').replace('/', ''))" data-ol-link-track="$track_value">$subject</a>$cond(not loop.last, ",", "")
      </span>
    </div>

$if work:
  $for tag in tags:
    $if tag=="Subjects":
      $:render_subjects(_("Subjects"), work.get_subjects(),"BookOverview|SubjectClick")
    $if tag=="People":
      $:render_subjects(_("People"), work.subject_people,"BookOverview|SubjectPeopleClick", prefix="person:")
    $if tag=="Places":
      $:render_subjects(_("Places"), work.subject_places,"BookOverview|SubjectPlacesClick", prefix="place:")
    $if tag=="Times":
      $:render_subjects(_("Times"), work.subject_times,"BookOverview|SubjectTimesClick", prefix="time:")
